<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>login</title>
<script src="${pageContext.request.contextPath}/js/jquery-2.2.3.min.js"></script>
<script src="${pageContext.request.contextPath}/js/jquery-ui.min.js"></script>
<link type="text/css" href="${pageContext.request.contextPath}/css/jquery-ui.min.css" rel="stylesheet">
<link href="${pageContext.request.contextPath}/css/bootstrap.min.css" rel="stylesheet">
<script src="${pageContext.request.contextPath}/js/bootstrap.min.js"></script>
<link type="text/css" href="${pageContext.request.contextPath}/css/login.css" rel="stylesheet">
<script src="${pageContext.request.contextPath}/js/my.js"></script>
<SCRIPT language = "JavaScript">
    function checkusercode(){    //验证用户名
        var fname = document.myform.usercode.value;
        var reg=/^[0-9a-zA-Z]/;
        if(fname.length != 0){
            for(i=0;i<fname.length;i++){
                if(!reg.test(fname)){
                    alert("只能输入字母或数字");
                    return false;}
            }
           
        }
        else{    alert("请输入用户名");
            document.myform.usercode.focus();
            return false     }
        return true;
    }

    function passCheck(){ //验证密码
        var userpass = document.myform.password.value;
        if(userpass == ""){
            alert("未输入密码 \n" + "请输入密码");
            document.myform.password.focus();
            return false;   
           }
        return true;   
        }
    function validateform(){
        if(checkusercode()&&passCheck( )&&checkEmail()&&checkbirthday())
                return true;
        else
            return false;
    }

    function clearText( ) {
        document.myform.user.value="" ;
        document.myform.password.value="" ;
    }

	//显示隐藏对应的switchPwd()方法:
	$(function(){
        // 通过jqurey修改
        $("#passwordeye").click(function(){
            let type =  $("#password").attr('type')
            if(type === "password"){
                $("#password").attr("type","text");
            }else{
                $("#password").attr("type","password");
            }
        });
	});


</SCRIPT>
</head>
<body>
<img src="${pageContext.request.contextPath}/images/login_bg.jpg" class="bg">
<div id="head">
	<img src="${pageContext.request.contextPath}/images/login_head.png" />
</div>
<div id="center">
<form name="myform" onSubmit="return validateform( )"  action="${pageContext.request.contextPath }/login.action" method="post" >
	<h1 id="message">${msg}</h1>
	<div class="input-group">
        <h3>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;账&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;号：</h3>&nbsp;<input class="form-control" id="usercode" name="usercode" type="text"  
        	style="height:40px;width:400px;margin-left:100px;" value="" placeholder="只能输入字母或数字"/>
	</div>
	</br>
	<div class="input-group" >        
		<h3>密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码：</h3>&nbsp;<input class="form-control" id="password" name="password" type="password" 
		    style="height:40px;width:400px;margin-left:100px;"  value="" placeholder="请输入密码"/>
		<span class="input-group-btn">
			<INPUT class="btn btn-default" id="passwordeye" type="button" value="show/hide" style="margin-top:50px;">
        </span>
	</div>

	<div id="btn">
		<INPUT class="btn btn-primary" name="loginButton" type="submit" id="Button" value="登陆"  onclick="checkusercode()">
		</br></br>
		</br>
		<a href="register.action"><INPUT class="btn btn-primary" name="registerButton" id="Button" type="button" value="注册"></a>
	</div>
</form>
</div>
</body>
</html>
